<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017-09-27
 * Time: 15:39
 */

namespace Home\Controller;


class MoreController extends ComController
{

		public function remen(){
			$is_hot_arr = D('novel')->where('is_flag=1')->order('rand()')->limit(15)->select();
			$this->assign('is_hot',$is_hot_arr);
			$this->display('remen');
		}
		
		public function xinshu(){
		//最新推出的小说
    	$new_novel = D('novel')->order('id desc')->where('is_shelf = 1')->limit(10)->select();
		$type = 'xs';
        $this->assign('new_novel', $new_novel);
        $this->assign('type', $type);
		$this->display('xinshu');
		}
		
		
		
		 public function ajax_book_list()
		{
			$file_path = C('FILE_HOST_PATH');
			if ($_POST['type'] == 'xs') {
				$djb_count = D('novel')->count();
				$page = $_POST['p'] * 10;
				if($page<$djb_count){
					$ranking_info = D('novel')->field('id,click_count,description,name,img,writer')->order('id desc')->where('is_shelf = 1')->limit($page, 10)->select();
					foreach ($ranking_info as $key => $value) {
						$id = $value['id'];
						$img_path = $file_path . $value['img'];
						$name = $value['name'];
						$writer = $value['writer'] ? $value['writer'] : '佚名';
						$dewcription = $value['description'];
						$data['data'] .= "<div class='item'>
						<a href='/Home/Novel/novelinfo/id/$id/'><img src='$img_path' class='avatar'>
							<div class='body'><span class='t'>$name</span><span class='author'>$writer</span><span class='btn'>立即阅读</span>
								<p>$dewcription</p>
							</div>
						</a>
					</div>";
					}
					$data['status'] = 1;
					$data['info'] = '成功';
					$this->ajaxReturn($data);
				}
			} 

        }
		
		
		
		
}